package com.heima.media.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.heima.common.dto.ResponseResult;
import com.heima.media.dto.SensitiveDto;
import com.heima.media.dto.WmSensitiveDto;
import com.heima.media.entity.WmSensitive;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.media.service.IWmSensitiveService;

import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 敏感词信息表 前端控制器
 * </p>
 *
 * @author itheima
 * @since 2022-01-17
 */
@RestController
@RequestMapping("/api/v1/sensitive")
@Api(tags = "敏感词信息表接口")
@CrossOrigin
public class WmSensitiveController {

    @Autowired
    private IWmSensitiveService wmSensitiveService;

    /**
     * 新增敏感词
     */
    @PostMapping
    public ResponseResult saveSensitive(@RequestBody WmSensitive wmSensitive) {
        wmSensitiveService.saveSensitive(wmSensitive);
        return ResponseResult.okResult();
    }

    /**
     * 查询敏感词
     */
    @PostMapping("/list")
    public ResponseResult findSensitive(@RequestBody WmSensitiveDto wmSensitiveDto) {
        return wmSensitiveService.findSensitive(wmSensitiveDto);
    }

    /**
     * 保存敏感词信息
     * Post请求方式
     */
    @PostMapping
    public ResponseResult saveSensitive(@RequestBody SensitiveDto dto) {
        return wmSensitiveService.saveSensitive(dto);
    }

    /**
     * 查看敏感词列表
     *
     * @return
     */
    @PostMapping("/list")
    public ResponseResult listSensitive(@RequestBody SensitiveDto dto) {
        return wmSensitiveService.listSensitive(dto);
    }

    /**
     * 更新敏感词实体信息
     *
     * @param dto
     * @return
     */
    @PutMapping
    public ResponseResult updateSensitive(@RequestBody SensitiveDto dto) {
        return wmSensitiveService.updateSensitive(dto);
    }

    /**
     * 删除敏感词实体信息
     */
    @DeleteMapping("/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id) {
        return wmSensitiveService.deleteSensitive(id);
     * 修改敏感词
     */
    @PutMapping
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.updateSensitive(wmSensitive);
    }

    /**
     * 删除敏感词
     */
    @DeleteMapping("/{id}")
    public ResponseResult deketeSensitive(@PathVariable Integer id) {
        return wmSensitiveService.deketeSensitive(id);
    }
}
